package cn.mill.core;

import cn.mill.common.data.DataCommon;

public class Result<T> implements DataCommon<Object> {
	
	private static final long serialVersionUID = 1062660556192400659L;
	
	private Object value;
	
	private Throwable exception;
	
	private boolean isfine;
	
	private String message;
	
	private String code;
	
	@Override
	public Object getValue() {
		return this.value;
	}
	
	public void setValue(Object value) {
		this.value = value;
	}
	
	@Override
	public Throwable getException() {
		return exception;
	}
	
	public void setException(Exception exception) {
		this.exception = exception;
	}
	
	@Override
	public boolean hasException() {
		return exception == null ? true : false;
	}
	
	@Override
	public boolean isFine() {
		return this.isfine;
	}
	
	public void setFine(boolean fine) {
		this.isfine = fine;
	}
	
	@Override
	public String getMessage() {
		return this.message;
	}
	
	public void setMessage(String message) {
		this.message = message;
	}
	
	@Override
	public String getCode() {
		return this.code;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	@Override
	public String toString() {
		return "Result [value=" + value + ", exception=" + exception + ", isfine=" + isfine + ", message=" + message + ", code=" + code + "]";
	}
}
